@{
    var authorId = WebSecurity.CurrentUserId.ToString();
    var articleId = UrlData[0];
    // check if the article exist
    var Article = Blog.DataObject.GetArticleByAuthorAndId(articleId,authorId);
    if(Article!=null){
       
        if(Article.published==1){
             // UNPUBLISH the article
           Blog.DataObject.ChangeArticlePublishedState(articleId,authorId.ToString(),"0");
        }else{
            // PUBLISH the article
            Blog.DataObject.ChangeArticlePublishedState(articleId,authorId.ToString(),"1");
        }
        // REDIRECT
        Response.Redirect(@Href("~/Actions/Admin/ListAllArticles",new{Success="Article published/unpublished"}));
    }else{
    Response.Redirect(@Href("~/Actions/Admin/ListAllArticles",new{Error="Nothing to publish"}));
    }
}